{include file='public/header' /}
<body class="layui-layout-body">

<div class="layui-layout layui-layout-admin">
    <!-- 头部 -->
    <div class="layui-header" style="background-color: rgb(25, 26, 35);">
        <div class="layui-logo">
            <img src="__STATIC__/assets/images/logo.png"/>
            <cite>&nbsp;融媒体</cite>
        </div>
        <ul class="layui-nav  layui-layout-left">
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="flexible" style="color: #fff" title="侧边伸缩"><i class="layui-icon layui-icon-shrink-right"></i></a>
            </li>
            <li class="layui-nav-item" lay-unselect>
                <a ew-event="refresh" style="color: #fff" title="刷新"><i class="layui-icon layui-icon-refresh-3"></i></a>
            </li>
            {foreach $menus as $k=>$vo}

            <li class="layui-nav-item bgt_nav layui-hide-xs {:auth($vo.href)} {if condition='$k eq 0'} layui-this {/if}" lay-unselect ><a nav-bind="xt{$k}"><strong style="color:#fff"><i class="layui-icon {$vo.icon}"></i>{$vo.title}</strong></a></li>

            {/foreach}
            <!-- 小屏幕下变为下拉形式 -->
        </ul>
        <ul class="layui-nav layui-layout-right" >
            {present name="test"}
            <li class="layui-nav-item" lay-unselect>
                {if condition="$test['store_id'] neq 0"}
                <a target="_blank" href="http://cmzx.dcpxjypt.cn/dist/#/?id={$test['id']}&store_id={$test['store_id']}" title=" 客服消息">
                    <i class="layui-icon layui-icon-notice"></i>
                    <span class="layui-badge-dot"></span>
                </a>
                {else/}
                <a target="_blank" href="http://cmzx.dcpxjypt.cn/dist1/#/?id={$test['id']}" title=" 客服消息">
                    <i class="layui-icon layui-icon-notice"></i>
                    <span class="layui-badge-dot"></span>
                </a>
                {/if}
            </li>
            {/present}
            <li class="layui-nav-item layui-hide-xs" lay-unselect>
                <a ew-event="fullScreen" style="color: #fff" title="全屏"><i class="layui-icon layui-icon-screen-full"></i></a>
            </li>

            <li class="layui-nav-item" lay-unselect>
                <a style="color: #fff">
                    <img src="__STATIC__/assets/images/head.png" class="layui-nav-img">
                    <cite>{$username}</cite>
                </a>

                <dl class="layui-nav-child" >
                 <!-- <dd lay-unselect><a ew-href="page/template/user-info.html">个人中心</a></dd>
                    <dd lay-unselect><a ew-event="psw">修改密码</a></dd>
                    <hr>-->
                    <dd lay-unselect><a ew-event="closeAllTabs" id="logout"    lay-unselect>退出</a></dd>
                </dl>
            </li>
            <!--<li class="layui-nav-item" lay-unselect>-->
                <!--<a ew-event="theme" title="主题"><i class="layui-icon layui-icon-more-vertical"></i></a>-->
            <!--</li>-->
        </ul>
    </div>

    <!-- 侧边栏 -->
    <div class="layui-side">
        <div class="layui-side-scroll">
            <!-- 系统一的菜单 -->

            {foreach $menus as $key=>$re}

            <ul class="layui-nav layui-nav-tree {:auth($re.href)} {if condition='$key neq 0'} layui-hide {/if}" nav-id="xt{$key}" lay-filter="admin-side-nav" style="margin: 15px 0;">
                {foreach $re.childs as $child}
                <li class="layui-nav-item {:auth($child.href)}">

                    <a {if condition="empty($child.childs)"} lay-href="{$child.href}" {/if} ><i class="layui-icon {$child.icon}  "></i>&emsp;<cite>{$child.title}</cite></a>

                    {if condition="!empty($child.childs)"}
                      {foreach $child.childs as $pchild}
                    <dl class="layui-nav-child {:auth($pchild.href)}">
                        <dd><a lay-href="{:__url($pchild.href)}">{$pchild.title}</a></dd>

                    </dl>
                       {/foreach}

                    {else/}


                    {/if}
                </li>
                {/foreach}
            </ul>
            {/foreach}

        </div>
    </div>
    <!-- 主体部分 -->
    <div class="layui-body"></div>
    <!-- 底部 -->

</div>
{include file='public/footer' /}
</body>
</html>
<script>
    layui.use(['layer', 'table', 'admin','form','layedit'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;

        $('#logout').click(function(){
            $.ajax({
                url:"{:url('index/out')}"
                ,success:function(res) {
                    layer.msg(res.msg,{offset: '250px',anim: 4});
                    if(res.code == 1) {
                        setTimeout(function(){
                            location.href = res.url;
                        },2000)
                    }
                }
            })

        });


        $(window).on('load', function() {
            for(var i=0;i<$(".bgt_nav").length;i++){
                if($(".bgt_nav").eq(i).hasClass("layui-this")){
                    $(".bgt_nav").eq(i).css('background-color','#009688')
                }
            }
        });

        $(".layui-hide-xs").on('click',function(){
            $(".layui-hide-xs").css('background-color','transparent');

            $(this).css('background-color','#009688')
        })
    })





</script>